/**
 * 
 */
package com.p2p.front.dal.dao;

import java.util.List;
import java.util.Map;

import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import com.p2p.base.dao.BaseMapper;
import com.p2p.front.dal.model.UserInfo;

/**
 * @author ruiqi
 *
 */
public interface UserInfoDao extends BaseMapper {

	@Insert("insert into p2p_user_info(user_id,info_name,info_value) values(#{userId},#{infoName},#{infoValue})")
	public void save(UserInfo userInfo);

	public List<UserInfo> findByNames(UserInfo userInfo);
	@Select("select * from p2p_user_info where user_id = #{userId} and info_name=#{infoName}")
	public Map<String, Object> getOne(UserInfo userInfo);

	public void batchSave(List<UserInfo> userInfoList);

	@Select("select * from p2p_user_info where user_id = #{uid} and info_name='borrower_auth'")
	public Map<String, Object> getBorrower(Long uid);
	
	@Select("replace into p2p_user_info(user_id,info_name,info_value) values(#{uid},'borrower_auth',#{auth})")
	public Map<String, Object> updateBorrower(@Param("uid") Integer uid,@Param("auth")String auth);

}
